﻿<%@ Page Language="C#" MasterPageFile="~/Masterpages/Default.master" AutoEventWireup="true"
    CodeBehind="ManageSettings.aspx.cs" Inherits="Blazing.UI.Cms.Admin.ManageSettings"
    Title="Manage Settings" %>

<%@ Register Src="../Usercontrols/ChooseSite.ascx" TagName="ChooseSite" TagPrefix="uc1" %>
<%@ Register Src="../Usercontrols/HiddenSite.ascx" TagName="HiddenSite" TagPrefix="uc2" %>
<%@ Register Assembly="System.BusinessObjects.Framework" Namespace="System.BusinessObjects.Controls"
    TagPrefix="cc1" %>
<%@ Register Src="../Usercontrols/Loading.ascx" TagName="Loading" TagPrefix="uc3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h1>
        Manage Settings</h1>
    <uc1:ChooseSite ID="ChooseSite1" runat="server" />
    <hr />
    <ajax:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="grid">
                <asp:GridView ID="GridViewSettings" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSourceSettings"
                    EmptyDataText="There are currently no settings for this site" DataKeyNames="ID,Site,RowStamp,RowState"
                    PageSize="100" Width="100%">
                    <Columns>
                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" ReadOnly="True" />
                        <asp:TemplateField HeaderText="Value" SortExpression="Value">
                            <InsertItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Value") %>' TextMode="MultiLine"
                                    Rows="4"></asp:TextBox>
                            </InsertItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Value") %>' TextMode="MultiLine"
                                    Rows="4"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("Value") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                    </Columns>
                </asp:GridView>
            </div>
            <asp:LinkButton ID="LinkButtonInsertSetting" runat="server">Insert</asp:LinkButton>
            <asp:Panel ID="PanelAddSetting" runat="server" SkinID="PopupPanel1">
                <blazing:RoundedPanel ID="rp1" runat="server" Width="400px">
                    <div class="grid">
                        <div class="gridview">
                            <asp:Panel runat="server" ID="PanelAddSettingTitle" CssClass="gridheader">
                                Add Setting</asp:Panel>
                            <br />
                            <br />
                            <asp:DetailsView ID="DetailsViewSetting" runat="server" AutoGenerateRows="False"
                                DataSourceID="ObjectDataSourceSettings" DefaultMode="Insert" GridLines="None">
                                <Fields>
                                    <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" InsertVisible="False"
                                        ReadOnly="True" />
                                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                                    <asp:TemplateField HeaderText="Value" SortExpression="Value">
                                        <InsertItemTemplate>
                                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Value") %>' TextMode="MultiLine"
                                                Rows="4"></asp:TextBox>
                                        </InsertItemTemplate>
                                        <EditItemTemplate>
                                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Value") %>'></asp:TextBox>
                                        </EditItemTemplate>
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Value") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                                    <asp:TemplateField HeaderText="" SortExpression="Site">
                                        <InsertItemTemplate>
                                            <uc2:HiddenSite ID="HiddenSite1" runat="server" CurrentSite='<%# Bind("Site") %>' />
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                            <uc2:HiddenSite ID="HiddenSite1" runat="server" CurrentSite='<%# Bind("Site") %>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:CommandField ShowInsertButton="True" />
                                </Fields>
                            </asp:DetailsView>
                        </div>
                    </div>
                </blazing:RoundedPanel>
            </asp:Panel>
            <ajax:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="LinkButtonInsertSetting"
                PopupControlID="PanelAddSetting" PopupDragHandleControlID="PanelAddSettingTitle"
                SkinID="Popup1">
            </ajax:ModalPopupExtender>
        </ContentTemplate>
    </ajax:UpdatePanel>
    <asp:ObjectDataSource ID="ObjectDataSourceSettings" runat="server" DataObjectTypeName="Blazing.BusinessObjects.Setting"
        DeleteMethod="DeleteSetting" InsertMethod="NewSetting" OldValuesParameterFormatString="original_{0}"
        SelectMethod="GetSettings" TypeName="Blazing.WebFacade.SettingsController" UpdateMethod="UpdateSetting">
        <SelectParameters>
            <asp:SessionParameter DefaultValue="-1" Name="siteId" SessionField="siteId" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <ajax:UpdateProgress runat="server" ID="update" DisplayAfter="50">
        <ProgressTemplate>
            <uc3:Loading ID="Loading1" runat="server" />
        </ProgressTemplate>
    </ajax:UpdateProgress>
    <br />
    <br />
</asp:Content>
